<?php
/**
 * Created by PhpStorm.
 * User: 10037
 * Date: 2022/6/11
 * Time: 18:50
 */

namespace app\admin\controller;


use app\admin\model\Usertable;
use Firebase\JWT\JWT;
use Firebase\JWT\Key;
use think\facade\Request;


class Login
{
    public function userLogin($name,$password){
        $user=new Usertable();

        $result= $user->userLogin($name,$password);

        if($result) {
            $key='zbc';
            $token=[
              "name"=>$name,
              "password"=>$password
            ];

           $jwt= JWT::encode($token,$key,'HS256');

            return json([
                'status'=>200,
                'token'=>$jwt,

            ]);


    }

        return json([
            'status'=>400,
        ]);
    }

    public function getIsLogin(){

    }
}